package ch05.shizhan.shizhan03;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.aspectj.lang.JoinPoint;

import java.util.Arrays;

/**
 * @author 崔书健
 * @date 2024/7/15
 */
public class UserServiceLogger {

    private static final Logger logger = LogManager.getLogger(UserServiceLogger.class);

    public void before(JoinPoint jp){
        logger.info("【shizhan03】调用" + jp.getTarget() + "的" + jp.getSignature().getName() + "方法。方法入参：" + Arrays.toString(jp.getArgs()));
    }

    public void afterRetuming(JoinPoint jp,Object result){
        logger.info("【shizhan03】调用 " + jp.getTarget() + " 的 " + jp.getSignature().getName() + " 方法。方法返回值：" + result);
    }
}
